package com.finance.base.exception;
 

/**
 * 业务异常类
 */
public class BusinessException extends BaseException {

    private static final long serialVersionUID = -4987001305340759909L;

    private BusinessException() {
        super();
    }

    private BusinessException(String errorCode) {
        super(errorCode);
    }

    private BusinessException(String errorCode, String... params) {
        super(errorCode, params);
    }

    private BusinessException(String errorCode, String message) {
        super(errorCode, message);
    }

    /**
     * 
     * <pre>
     * 抛出业务逻辑异常信息
     * </pre>
     *
     * @param params 异常信息
     */
    public static void throwMessage(String errorCode, String... params) {
        throw new BusinessException(errorCode, params);
    }

    /**
     * 
     * <pre>
     * 抛出业务逻辑异常信息
     * </pre>
     *
     * @param message 异常信息
     */
     public static void throwMessageWithCode(String errorCode, String message) {
         throw new BusinessException(errorCode, message);
     }

    /**
     * 
     * <pre>
     * 抛出业务逻辑异常信息
     * </pre>
     *
     * @param exceptionEnum 异常信息
     */
    public static void throwMessageWithCode(ExceptionEnum exceptionEnum) {
        String errorCode = exceptionEnum.getErrorCode();
        String message = exceptionEnum.getErrorMsg();
        throw new BusinessException(errorCode, message);
    }

}
